package com.bawei.model_sevent.Activity.Activity;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bawei.model_sevent.Activity.Fragemnt.BlankFragment_shoppCar;
import com.bawei.model_sevent.Activity.MySql.MySql;
import com.bawei.model_sevent.R;
import com.bumptech.glide.Glide;

@Route(path = "/shopping/one")
public class MainActivity_shopping extends AppCompatActivity {

    private ImageView imgShoping;
    private TextView tvShoping;
    private ImageView showShoping;
    private Button joinClass;
    
      @Autowired(name = "name")
      String name;
      @Autowired(name = "images")
      String images;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_shopping);
        initView();
        ARouter.getInstance().inject(this);//注入
        Glide.with(this).load(images).into(imgShoping);
        tvShoping.setText(name);
        joinClass.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MySql mySql = new MySql(MainActivity_shopping.this, "goods.dp", null, 1);
                SQLiteDatabase writableDatabase = mySql.getWritableDatabase();
                writableDatabase.execSQL("insert into goods values(?,?)",new Object[]{name,images});
                
            }
        });
    }

    private void initView() {
        imgShoping = findViewById(R.id.img_shoping);
        tvShoping = findViewById(R.id.tv_shoping);
        showShoping = findViewById(R.id.show_shoping);
        joinClass = findViewById(R.id.join_class);
    }
}